package com.aegis.manage.controller.sys;

import com.aegis.common.mybatis.base.BaseController;
import com.aegis.manage.api.request.UpdateUserProfileRequest;
import com.aegis.manage.api.vo.UserDetailVO;
import com.aegis.manage.service.sys.user.SysUserService;
import com.aegis.manage.utils.AuthUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @Author wuweixin
 *
 * @Version 1.0
 * @Descritube
 */
@RestController
@RequestMapping("/sys/user/profile")
@Api(tags = "系统-用户信息")
public class SysUserProfileController extends BaseController<SysUserService> {


    @ApiOperation(value = "查询用户用户资料", notes = "查询用户用户资料")
    @GetMapping
    public UserDetailVO queryUserProfile() {
        return getService().getUserDetailById(AuthUtil.getLoginUserId());
    }


    @ApiOperation(value = "更新用户资料", notes = "更新用户资料")
    @PutMapping
    public void updateUserProfile(@RequestBody @Validated UpdateUserProfileRequest updateUserProfileRequest) {
        getService().updateUserProfile(updateUserProfileRequest);
    }


}
